package beans;

import entities.Image;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class ImageFacade extends AbstractFacade<Image> {
    @PersistenceContext(unitName = "ProjetAppliWebPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ImageFacade() {
        super(Image.class);
    }

    public Image create(String url, int width, int height) {
        Image image = new Image(url, width, height);
        create(image);
        return image;
    }
}